OPTFLAGS	= -O3 -Wall -Werror -Wextra -pedantic -g
CC		= gcc
MAKE		= make
RM		= rm -f
DOXYGEN 	= doxygen

%.o: %.c
	$(CC) $(OPTFLAGS) -o $@ -c $<

all: libsem182 sender empfaenger

libsem182:
	$(MAKE) -C sem182 libsem182.a

sender: libsem182 myrxtx.o sender.o
	$(CC) $(OPTFLAGS) -o sender myrxtx.o -Lsem182 sender.o -lsem182

empfaenger: libsem182 myrxtx.o empfaenger.o
	$(CC) $(OPTFLAGS) -o empfaenger myrxtx.o -Lsem182 empfaenger.o -lsem182

clean:
	$(MAKE) -C sem182 clean
	$(RM) *.o *.h.gch sender empfaenger

fresh: clean all

clean_doc:
	$(RM) -r doc/

doc: clean_doc
	$(DOXYGEN)

clean_all: clean clean_doc

